	processor 6502
	org $0801
BASIC
	dc.b $0c,$08,$06,$00,$9e,$20,$32,$30
	dc.b $36,$34,$00,$00,$00,$00,$00
START
	jsr PlotLines
	jsr SetupIRQ
	lda #$01
	sta $d03f ;Set Magic bit and enable extended features
	
SL	jmp SL


IRQ
	lda #$00
	;sta $d020
	sta curcol
	inc $d019
	ldy #$00
IRQ1
	tya
	pha
	;dec $d020

	ldx #$00
IRQ2
	lda curcol
	sta $d200,x
	inc curcol
	inx
	cpx #$0f
	bne IRQ2
	
	ldx #$02
IRQ4
	ldy #$24
IRQ3
	dey
	bne IRQ3
	dex
	bne IRQ4

	
	pla
	tay
	
	iny
	cpy #$10
	bne IRQ1
	
	jmp $ea81
	
SetupIRQ
	sei
	inc $d019
	inc $d01a
	lda #$7f
	sta $dc0d
	lda #$1b
	sta $d011
	lda #$31
	sta $d012
	lda #<IRQ
	sta $0314
	lda #>IRQ
	sta $0315
	cli
	rts
	

PlotLines
	ldy #$00
PL2
	ldx #$00
PL1
	lda char,x
PLS	sta $0400,x
	lda color,x
PLC	sta $d800,x
	inx
	cpx #$28
	bne PL1
	clc
	lda #$28
	adc PLS+$01
	sta PLS+$01
	bcc PLx1
	inc PLS+$02
PLx1
	clc
	lda #$28
	adc PLC+$01
	sta PLC+$01
	bcc PLx2
	inc PLC+$02
PLx2
	iny
	cpy #$19
	bne PL2
	rts
	
	
char
	dc.b $20,$20,$20,$20,$a0,$a0,$a0,$a0
	dc.b $a0,$a0,$a0,$a0,$a0,$a0,$a0,$a0
	dc.b $a0,$a0,$a0,$a0,$a0,$a0,$a0,$a0
	dc.b $a0,$a0,$a0,$a0,$a0,$a0,$a0,$a0
	dc.b $a0,$a0,$a0,$a0,$20,$20,$20,$20
color
	dc.b $00,$00,$00,$00,$00,$00,$01,$01
	dc.b $02,$02,$03,$03,$04,$04,$05,$05
	dc.b $06,$06,$07,$07,$08,$08,$09,$09
	dc.b $0a,$0a,$0b,$0b,$0c,$0c,$0d,$0d
	dc.b $0e,$0e,$0f,$0f,$00,$00,$00,$00
	
curcol	dc.b $00
